package com.demo.user.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonView;
import lombok.*;
import org.springframework.lang.NonNull;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;

/**
 * 用户对象
 *
 * @author YT
 * @date 2019-05-19
 */
@Data
@TableName("user")
@EqualsAndHashCode(callSuper = true)
public class User extends Model<User> {

    /**
     * ID 标识
     */
    @JsonView(UserBaseView.class)
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    private String id;

    /**
     * 用户名
     */
    @JsonView(UserDetalView.class)
    @TableField(value = "name")
    @NotBlank(message = "名称不能为空")
    private String name;

    public interface UserBaseView {
    }

    public interface UserDetalView extends UserBaseView {
    }
}